package com.hqyj.am.controller;



import com.hqyj.am.pojo.MyPage;
import com.hqyj.am.pojo.ResultVo;
import com.hqyj.am.pojo.User;
import com.hqyj.am.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
<<<<<<< HEAD
 * @since 2022-08-17
=======
 * @since 2022-08-18
>>>>>>> origin/dev
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    IUserService iUserService;

    @GetMapping("/query")
    public ResultVo loadAllUser(MyPage myPage){
        return iUserService.queryUser(myPage);
    }

    @GetMapping("/del")
    public ResultVo delUser(Integer userId){
        return iUserService.delUser(userId);
    }

    @GetMapping("/queryRoleAndDepartment")
    public ResultVo queryRoleAndDepartment(){
        return iUserService.queryRoleAndDepartment();
    }

    @GetMapping("/add")
    public ResultVo addUser(User user){
        return iUserService.addUser(user);
    }

    @GetMapping("/show")
    public ResultVo showUser(Integer userId){
        return iUserService.showUser(userId);
    }

    @PostMapping("/update")
    public ResultVo updateUser(User user){
        return iUserService.updateUser(user);
    }
}

